package container

import "fmt"

func TestArray() {
	var a [3]int
	var b [4]int

	fmt.Printf("%T %v\n", a, a)
	fmt.Printf("%T %v\n", b, b)

	testArr := [3]int{}
	numArr := [3]int{1, 2, 3}

	cityArr := [3]string{"beijing", "上海", "guangzhou"}

	fmt.Println(testArr)
	fmt.Println(numArr)
	fmt.Println(cityArr)

	numArr2 := [...]int{}
	fmt.Println(numArr2)
	fmt.Println(len(numArr2))

	for i := 0; i < len(cityArr); i++ {
		fmt.Println(cityArr[i])
	}

	for index, value := range cityArr {
		fmt.Printf("%d=%s\n", index, value)
	}

	arr := [3][2]string{
		{"北京", "1"}, {"上海", "2"}, {"深圳", "3"},
	}

	fmt.Println(arr)
	fmt.Println(arr[2][1])

	for _, a := range arr {
		for _, value := range a {
			fmt.Println(value)
		}
	}

	arr2 := [...][2]string{
		{"北京", "上海"},
		{"广州", "深圳"},
		{"成都", "重庆"},
	}

	fmt.Println(arr2)
}
